<?php
$this->widget('application.extensions.fancybox.EFancyBox', array('target' => '.tracking', 'config' => array('width' => 800, 'height' => 300,'type'=>'iframe','hideOnOverlayClick'=>false, 'onClosed'=>'js:function(){window.location.href="'.Yii::app()->createUrl("psi/update",array("id"=>$model->PricingIndex)).'";}')));
if($model->PricingIndex){
	if(Helper::getAbleNumByPricingIndex($model->PricingIndex)>0){
?>
<div style="text-align:right; padding:10px 10px 0 0; font-weight:bold;"><a id="item" class='tracking' href="<?=Yii::app()->createUrl('psi/addMid',array('pricingIndex'=>$model->PricingIndex))?>">关联运输记录</a></div>
<?php
}
?>
<?php
	$rowTable = $model->mids;
	if($rowTable){    
?>
<table class="detail-view" style="margin-top:10px;">
    <tbody>
		<tr class="head">
			<td width="15%" style="text-align:center;">货柜编号</td>
			<td style="text-align:center;">箱号</td>
			<td width="10%" style="text-align:center;">运输方式</td>
			<td width="8%" style="text-align:center;">未出货数量</td>
			<td width="10%" style="text-align:center;">运出数量</td>
			<td width="8%" style="text-align:center;">删除</td>
			<td width="8%" style="text-align:center;">编辑</td>
			<td width="6%">详情</td>		
        </tr>
<?php
		$i = 0;
		$cssArr = array(0 => 'odd', 1 => 'even');
		foreach($rowTable as $item){
			$trClass = $cssArr[$i % 2];
			$i++;
			$box = '';
			if($item->tracking->ShippingType=='Express'){
				$box = $item->tracking->EBoxNumber;
			}else{
				$box = $item->CBoxNumber;
			}
?>
        <tr>
			<td>
				<?=$item->tracking->CarrierNo?>
			</td>
			<td>
				<?=$box?>
			</td>
			<td>
				<?=$item->tracking->ShippingType?>
			</td>	
			<td style="text-align:center;">
				<?=$model->Balance-$model->ToLAQty?>
			</td>	
			<td style="text-align:center;">
				<?=$item->ToLAQty?>
			</td>			
			<td style="text-align:center;">
			<?php
			if($item->tracking->ShippingStatus!='Delivery'){
			?>
				<a onclick="return confirm('确认要删除:<?=$item->TrackingIndex?>')" href="<?=Yii::app()->createUrl('psi/deleteTrackingItem',array('id'=>$item->MidIndex,'pid'=>$model->PricingIndex))?>">删除</a>
			<?php
			}
			?>&nbsp;
			</td>
			<td style="text-align:center;">
			<?php
			if($item->tracking->ShippingStatus!='Delivery'){
			?>
				<a class="tracking" href="<?=Yii::app()->createUrl('psi/addMid',array('pricingIndex'=>$model->PricingIndex,'midIndex'=>$item->MidIndex))?>">编辑</a>
			<?php
			}
			?>&nbsp;				
			</td>			
			<td style="text-align:center;">
				<a target="_blank" href="<?=Yii::app()->createUrl('psi/trackingUpdate',array('trackingIndex'=>$item->tracking->TrackingIndex))?>">详情</a>
			</td>
        </tr>
<?php        
		}
?>
    </tbody>
</table>
<?php
	}
?>
<?php
}
?>